<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS 简单图形</title>
    <style>
        * {
            box-sizing: border-box;
        }
        .clearfix::after {
            content: '';
            display: block;
            clear: both;
        }
        .wrapper div {
            float: left;
            margin-right: 20px;
            width: 100px;
            height: 100px;
            background-color: #C2F346;
        }
        /* 正方形 */
        .wrapper .square1 {
        }
        /* 长方形 */
        .wrapper .square2 {
            width: 150px;
        }
        /* 圆形 */
        .wrapper .round {
            border-radius: 50%;
        }
        /* 平行四边形 */
        .wrapper .parallelogram {
            transform: skewX(-30deg);
        }
        /* 梯形 */
        .wrapper .trapezoid {
            transform: perspective(100px) rotateX(45deg);
            transform-origin: bottom;
        }
        /* 三角形 */
        .wrapper .triangle {
            transform: rotate(45deg);
            background: linear-gradient(135deg, transparent 50%, #C2F346 50%);
        }
        /* 椭圆 */
        .wrapper .ellipse {
            /* width: 200px; */
            border-radius: 50%;
            transform: skewX(-30deg);
        }
        /* border 制作梯形和三角形*/
        .wrapper .border-trapezoid {
            width: 0;
            height: 0;
            border: 50px solid transparent;
            border-top-color: tomato;
            border-right-color: teal;
            border-bottom-color: yellowgreen;;
            border-left-color: blueviolet;
        }
        .wrapper .border-triangle {
            width: 100px;
            height: 100px;
            background-color: transparent;
            border: 25px solid transparent;
            border-top-color: tomato;
            border-right-color: teal;
            border-bottom-color: yellowgreen;;
            border-left-color: blueviolet;
        }
    </style>
</head>
<body>
    <div class="wrapper clearfix">
        <div class="square1"></div>
        <div class="square2"></div>
        <div class="round"></div>
        <div class="parallelogram"></div>
        <div class="trapezoid"></div>
        <div class="triangle"></div>
        <div class="ellipse"></div>
        <div class="border-trapezoid"></div>
        <div class="border-triangle"></div>
    </div>
</body>
</html>